<template>
  <div class="flex-x flex-space w100">
    <div>
      <span v-if="deviceRow.name">
        {{ deviceRow.deviceParentName }}/{{ deviceRow.name }}
      </span>
    </div>

    <div class="flex-x">
      <div class="flex-x" style="margin-right: 10px">
        <el-date-picker
          style="margin-right: 20px;"
          class="w100 dark_input"
          v-model="dataPicker"
          type="datetimerange"
          value-format="yyyy-MM-dd HH:mm:ss"
          align="right"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="['12:00:00', '08:00:00']"
          size="mini"
        >
        </el-date-picker>
      </div>

      <el-button type="primary" size="small" @click="onSubmit">查 询</el-button>
      <el-button size="small" @click="handleReset">重 置</el-button>
    </div>
  </div>
</template>

<script>
import { currentDate3 } from "@/utils/currentDate";
export default {
  props: {
    deviceRow: {
      type: Object,
      default: {}
    }
  },
  data() {
    return {
      form: {
        startDate: "",
        endDate: ""
      },
      dataPicker: []
    };
  },
  methods: {
    onSubmit() {
      this.$emit("onSubmit", {
        startDate: this.dataPicker.length ? this.dataPicker[0] : "",
        endDate: this.dataPicker.length ? this.dataPicker[1] : ""
      });
    },
    handleReset() {
      // Object.assign(this.$data.form, this.$options.data().form);
      this.dataPicker = [];
      this.$emit("onSubmit");
    }
  }
};
</script>
<style lang="scss" scoped></style>
